<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>
<form enctype="multipart/form-data"></form>
<script>
	/*let arr = [12,5,8,9];
	arr.forEach((item)=>{
		alert(item);
	})*/
		function solution(roman){
			// complete the solution by transforming the
			// string roman numeral into an integer
			var json = {"I":1,"V":5,"X":10,"L":50,"C":100,"D":500,"M":1000,"F":4,"N":9}
			roman = roman.replace(/IV|IX/g,function (rs) {
			  switch (rs){
			    case "IV":
			    	return "F";
			    case "IX":
			    	return "N";
			  }
			})
			var arr=roman.split("");
			var sum =0;
			arr.forEach(tem=>{
				sum += json[tem]*1;
			})
			return sum;
		}
		solution("I")
</script>
</body>
</html>